package www.ym.com.common;

import lombok.Data;

import java.util.List;

@Data
public class RL<T> {
    private Integer code;  //编码：1成功，其他数字和0为失败
    private String msg;  //错误信息
    private T data;   //数据

    private List<T> listData;  //分页数据

    private long pageNum; //当前页

    private long pageSize; //每页条数

    private long total; //总数

    //分页响应
    public static <T> RL<T> listSuccess(List<T> object, String msg, long total, long pageNum, long pageSize) {
        RL<T> r = new RL<T>();
        r.code = 1;
        r.listData = object;
        r.msg = msg;
        r.total = total;
        r.pageNum = pageNum;
        r.pageSize = pageSize;
        return r;
    }
}
